home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ConditionalMacros.h
-
- Copyright: © 1984-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Version: Universal Interfaces 2.0a3 ETO #16, MPW prerelease. Friday, November 11, 1994.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
-
- #ifndef __CONDITIONALMACROS__
- #define __CONDITIONALMACROS__
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if GENERATINGPOWERPC
- #pragma options align=mac68k
- #endif
-
- #ifdef __CFM68K__
- #pragma lib_export on
- #endif
-
- /*
- This file sets up the following compiler independent conditionals:
-
- GENERATINGPOWERPC - Compiler is generating PowerPC instructions
- GENERATING68K - Compiler is generating 68k family instructions
- GENERATING68881 - Compiler is generating mc68881 floating point instructions
- GENERATINGCFM - Code being generated assumes CFM calling conventions
- CFMSYSTEMCALLS - No A-traps. Systems calls are made using CFM and UPP's
-
- SystemSevenFiveOrLater - Compiled code will only be run on a System 7.5 or later Macintosh
- SystemSevenOrLater - Compiled code will only be run on a System 7.0 or later Macintosh
- SystemSixOrLater - Compiled code will only be run on a System 6.0 or later Macintosh
- A developer should set the appropriate flag on the compiler command-
- line or in a file processed before this file. This will allow the
- certain optimizations to be made which can result in smaller, faster
- applications.
-
- CGLUESUPPORTED - Interface library will support "C glue" functions (function names
- are: all lowercase, use C strings instead of pascal strings, use
- Point* instead of Point).
-
- OLDROUTINENAMES - "Old" names for Macintosh system calls are allowed in source code.
- (e.g. DisposPtr instead of DisposePtr). The names of system routine
- are now more sensitive to change because CFM binds by name. In the
- past, system routine names were compiled out to just an A-Trap.
- Macros have been added that each map an old name to its new name.
- This allows old routine names to be used in existing source files,
- but the macros only work if OLDROUTINENAMES is true. This support
- will be removed in the near future. Thus, all source code should
- be changed to use the new names! You can set OLDROUTINENAMES to false
- to see if your code has any old names left in it.
-
- OLDROUTINELOCATIONS - "Old" location of Macintosh system calls are used. For example, c2pstr
- has been moved from Strings to TextUtils. It is conditionalized in
- Strings with OLDROUTINELOCATIONS and in TextUtils with !OLDROUTINELOCATIONS.
- This allows developers to upgrade to newer interface files without suddenly
- all their code not compiling becuase of "incorrect" includes. But, it
- allows the slow migration of system calls to more understandable file
- locations. OLDROUTINELOCATIONS currently defaults to true, but eventually
- will default to false.
-
-
- There are some invariants among the conditionals:
-
- GENERATINGPOWERPC != GENERATING68K
- GENERATING68881 => GENERATING68K
- GENERATINGPOWERPC => GENERATINGCFM
- GENERATINGPOWERPC => CFMSYSTEMCALLS
- CFMSYSTEMCALLS => GENERATINGCFM
- GENERATINGPOWERPC => SystemSevenOrLater
- SystemSevenFiveOrLater => SystemSevenOrLater
- SystemSevenOrLater => SystemSixOrLater
-
-
- */
- #ifdef GENERATINGPOWERPC
- #define GENERATING68K !GENERATINGPOWERPC
- #endif
- #ifdef GENERATING68K
- #define GENERATINGPOWERPC !GENERATING68K
- #endif
- #ifndef GENERATINGPOWERPC
- #if defined(powerc) || defined(__powerc)
- #define GENERATINGPOWERPC 1
- #else
- #define GENERATINGPOWERPC 0
- #endif
- #endif
- #ifndef GENERATING68K
- #if GENERATINGPOWERPC
- #define GENERATING68K 0
- #else
- #define GENERATING68K 1
- #endif
- #endif
- #if GENERATING68K
- #if defined(applec) || defined(__SC__)
- #ifdef mc68881
- #define GENERATING68881 1
- #endif
- #elif __MWERKS__
- #if __MC68881__
- #define GENERATING68881 01
- #endif
- #endif
- #endif
- #ifndef CGLUESUPPORTED
- #if defined(THINK_C) || (defined(__SC__) && !defined(__CFM68K__))
- #define CGLUESUPPORTED 0
- #else
- #define CGLUESUPPORTED 1
- #endif
- #endif
- #ifndef GENERATING68881
- #define GENERATING68881 0
- #endif
- #if GENERATINGPOWERPC
- #define CFMSYSTEMCALLS 1
- #define GENERATINGCFM 1
- #endif
- #ifndef GENERATINGCFM
- #ifndef __CFM68K__
- #define GENERATINGCFM 0
- #define CFMSYSTEMCALLS 0
- #else
- #define GENERATINGCFM 1
- #define CFMSYSTEMCALLS 1
- #endif
- #endif
- #ifndef CFMSYSTEMCALLS
- #define CFMSYSTEMCALLS 0
- #endif
- #ifndef SystemSevenFiveOrLater
- #define SystemSevenFiveOrLater 0
- #endif
- #ifndef OLDROUTINENAMES
- #define OLDROUTINENAMES 1
- #endif
- #ifndef OLDROUTINELOCATIONS
- #define OLDROUTINELOCATIONS 1
- #endif
- #ifndef SystemSevenOrLater
- #if GENERATINGCFM || SystemSevenFiveOrLater
- #define SystemSevenOrLater 1
- #else
- #define SystemSevenOrLater 0
- #endif
- #endif
- #ifndef SystemSixOrLater
- #define SystemSixOrLater SystemSevenOrLater
- #endif
- #if OLDROUTINENAMES
- #ifndef USES68KINLINES
- #define USES68KINLINES GENERATING68K
- #endif
- #define USESCODEFRAGMENTS GENERATINGCFM
- #define USESROUTINEDESCRIPTORS GENERATINGCFM
- #endif
- #if CFMSYSTEMCALLS
- #define ONEWORDINLINE(trapNum)
- #define TWOWORDINLINE(w1, w2)
- #define THREEWORDINLINE(w1, w2, w3)
- #define FOURWORDINLINE(w1, w2, w3, w4)
- #define FIVEWORDINLINE(w1, w2, w3, w4, w5)
- #define SIXWORDINLINE(w1, w2, w3, w4, w5, w6)
- #define SEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7)
- #define EIGHTWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8)
- #define NINEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9)
- #define TENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10)
- #define ELEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11)
- #define TWELVEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12)
- #else
- #define ONEWORDINLINE(trapNum) \
- = trapNum
- #define TWOWORDINLINE(w1, w2) \
- = {w1,w2}
- #define THREEWORDINLINE(w1, w2, w3) \
- = {w1,w2,w3}
- #define FOURWORDINLINE(w1, w2, w3, w4) \
- = {w1,w2,w3,w4}
- #define FIVEWORDINLINE(w1, w2, w3, w4, w5) \
- = {w1,w2,w3,w4,w5}
- #define SIXWORDINLINE(w1, w2, w3, w4, w5, w6) \
- = {w1,w2,w3,w4,w5,w6}
- #define SEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7) \
- = {w1,w2,w3,w4,w5,w6,w7}
- #define EIGHTWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8) \
- = {w1,w2,w3,w4,w5,w6,w7,w8}
- #define NINEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) \
- = {w1,w2,w3,w4,w5,w6,w7,w8,w9}
- #define TENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) \
- = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10}
- #define ELEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) \
- = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11}
- #define TWELVEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) \
- = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12}
- #endif
-
- #ifdef __CFM68K__
- #pragma lib_export off
- #endif
-
- #if GENERATINGPOWERPC
- #pragma options align=reset
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __CONDITIONALMACROS__ */
-